<%@ Control Language="C#" %>
<script runat="server">

    public string PageNoQueryString = "page";
    public int PageCount = 0;
    public int PageSize =30;
    public string LinkTemplate = "";
    public string SelectedLinkTemplate = "";
   
    int pageNo = 1;
    
    public int CurrentPageNo {
        get {
            if (!String.IsNullOrEmpty(Request.QueryString[PageNoQueryString])) {
                return int.Parse(Request.Params[PageNoQueryString]);
            }
            return 1; 
        }
    }
    
    void Page_Load(Object sender, EventArgs e) {
        if (!String.IsNullOrEmpty(Request.QueryString[PageNoQueryString]))
        {
            pageNo = int.Parse(Request.Params[PageNoQueryString]);
        }

        if (PageCount > 1)
        {

            StringBuilder sb = new StringBuilder();

            for (int i = 1; i <= PageCount; i++)
            {
                if (i == pageNo)
                {
                    sb.AppendFormat(SelectedLinkTemplate + " ", i, i);
                }
                else
                {
                    sb.AppendFormat(LinkTemplate + " ", i, i);
                }
            }

            myLiteral.Text = sb.ToString();
        }
        else
        {
            this.Visible = false;
        }
    }
  
</script>
<div class="pager">
<asp:Literal id="myLiteral" runat="server"></asp:Literal>
</div>